import { Base } from "../../utils/base.js"

class Collection extends Base {
  constructor() {
    super();
  }


  // 收藏商品
  getCollectionAdd(id, callback) {
    var params = {
      url: 'collection/add',
      data: { 'product_id': id },
      type: 'post',
      sCallback: function (data) {
        callback && callback(data);
      }
    }
    this.request(params);
  }

  // 取消收藏
  getCollectionDel(id, callback) {
    var params = {
      url: 'collection/del',
      data: { 'product_id': id },
      type: 'post',
      sCallback: function (data) {
        callback && callback(data);
      }
    }
    this.request(params);
  }

  // 收藏列表数据
  getCollectionLists(page,callback) {
    var params = {
      url: 'collection/lists?expand=product&page=' + page,
      data: {'num':20},
      type: 'post',
      sCallback: function (data) {
        callback && callback(data);
      }
    }
    this.request(params);
  }

};

export { Collection };